<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <link rel="stylesheet" href="http://cdn.staticfile.org/cesium/1.69.0/Widgets/widgets.css">
    <link rel="stylesheet" href="../css//index.css">
</head>

<body>
    <div class="fun-menu">
        <button onclick="switchTerrain('arcgis')">arcgis</button>
        <button onclick="switchTerrain('tdt')">天地图</button>
        <button onclick="switchTerrain('cesium')">cesium</button>
        <button onclick="switchTerrain('SingleTileImageryLayer')">单张图片底图</button>
    </div>
    <div id=cesiumContainer></div>

    <script src="http://cdn.staticfile.org/cesium/1.69.0/Cesium.js"></script>
    <script src="../libs/cpc/index.js"></script>
    <script>
        const map = new cpc.Map({
            container: "cesiumContainer",
            camera: {
                position: {
                    x: 119.3006147,
                    y: 26.0316619,
                    z: 4809,
                },
                angle: {
                    heading: 0,//水平角度
                    pitch: -10,//俯仰角度
                    roll: 0,//旋转角度
                },
            },
            baseMaps: [
                "http://map.geoq.cn/arcgis/rest/services/ChinaOnlineStreetPurplishBlue/MapServer",
            ],
            terrain: {
                type: "tdt",
                option: {
                    tk: "7b435c61bff7f77eb49206e10d6397bd",
                    urls: [
                        //天地图自己的插件
                        "../libs/tdt/cesiumTdt.js",
                        "../libs/tdt/zlib.min.js",
                    ],
                },
            },
        });

        function switchTerrain(type) {
            switch (type) {
                case "arcgis":
                    map.terrain.setTerrain({
                        type: "arcgis",
                        option: {
                            url:
                                "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer",
                        },
                    });
                    break;
                case "tdt":
                    map.terrain.setTerrain({
                        type: "tdt",
                        option: {
                            tk: "7b435c61bff7f77eb49206e10d6397bd",
                            urls: [
                                //天地图自己的插件
                                "../libs/tdt/cesiumTdt.js",
                                "../libs/tdt/zlib.min.js",
                            ],
                        },
                    });
                    break;
                case "cesium":
                    map.terrain.setTerrain({
                        type: "cesium",
                        option: {
                            // url:"http://localhost/teerain/terrain",//本地福建地形
                            url: "http://data.marsgis.cn/terrain", //全国30m地形
                            // url:"https://www.supermapol.com/realspace/services/3D-stk_terrain/rest/realspace/datas/info/data/path",//超图地形
                            requestWaterMask: true, //开启法向量
                            requestVertexNormals: true, //开启水面特效
                        },
                    });
                    break;
                case "SingleTileImageryLayer":
                    map.terrain.setTerrain({
                        type: "cesium",
                        option: {
                            url:
                                "https://www.supermapol.com/realspace/services/3D-stk_terrain/rest/realspace/datas/info/data/path",
                            requestWaterMask: true, //开启法向量
                            requestVertexNormals: true, //开启水面特效
                        },
                    });
                    break;
            }
        }
    </script>
</body>

</html>